#include <iostream>
#include <vector>
/**
 * @brief 参考答案
 * 
 */
std::vector<int>::iterator serch_vec(std::vector<int>::iterator beg, std::vector<int>::iterator end, int val)
{
    for( ; beg != end; beg++)
    {
        if(*beg == val)
        {
            return beg;
        }
    }
    return end;
}

int main()
{
    std::vector<int> ilist = {1, 2, 3, 4, 5, 6, 7, 8};
    std::cout << serch_vec(ilist.begin(), ilist.end(), 3) - ilist.begin() << std::endl;
}